package qlsl.androiddesign.view.subview.activityview;

import com.qlsl.androiddesign.kuaiwa.R;

import android.view.View;
import android.widget.BaseAdapter;
import qlsl.androiddesign.activity.subactivity.MyPostActivity;
import qlsl.androiddesign.activity.subactivity.PostingDetailActivity;
import qlsl.androiddesign.adapter.subadapter.MemberPostingAdapter;
import qlsl.androiddesign.entity.otherentity.Posting;
import qlsl.androiddesign.http.service.subservice.ForumService;
import qlsl.androiddesign.view.subview.activityview.peoplecenterbase.PeopleCenterBaseView;

/**
 * 我的发帖<br/>
 * 需要传入的键：<br/>
 * 传入的值类型： <br/>
 * 传入的值含义：<br/>
 * 是否必传 ：
 */
public class MyPostView extends PeopleCenterBaseView<Posting, MyPostActivity> {

	public MyPostView(MyPostActivity activity) {
		super(activity);
	}

	protected void initView(View view) {
		super.initView(view);
		setTitle("我的发帖");
	}

	protected void initData() {
		super.initData();
		ForumService.queryPostingList(1, this, activity);
	}

	protected void initListener() {
		super.initListener();
	}

	public void onClick(View view) {
		switch (view.getId()) {
		case R.id.list_item:
			doClickListItem(view);
			break;
		}
	}

	private void doClickListItem(View view) {
		int position = refreshView.getRefreshableView().getPositionForView(view);
		Posting item = (Posting) refreshView.getAdapter().getItem(position);
		startActivity(item, PostingDetailActivity.class);
	}

	public BaseAdapter getAdapter() {
		return new MemberPostingAdapter(activity, list);
	}

}
